package com.beijing.cyou.utils;

import javax.servlet.http.HttpServletResponse;

import com.beijing.cyou.module.Result;

public class CommonConstant {

	public static String common_message_exception = "## 参数异常/不全,请检查！ @@";
	

	/**	GET 操作成功正常返回码	**/
	public static final int HTTP_GET_SUCCESS_STATUS_CODE = 200;

	/**	GET 操作成功，但是数据无值	**/
	public static final int HTTP_GET_FAIL_STATUS_CODE = 210;
	
	/**	POST 操作成功正常返回码	**/
	public static final int HTTP_POST_SUCCESS_STATUS_CODE = 201;

	/**	POST excel表 -- 提交异常	**/
	public static final int HTTP_POST_EXCEPTION = 217;
	

	/** 设置http get 返回成功 **/
	public static void setHttpGetSuccessStatusCode(Result result, HttpServletResponse response) {
		response.setStatus(CommonConstant.HTTP_GET_SUCCESS_STATUS_CODE);
		result.setCode(CommonConstant.HTTP_GET_SUCCESS_STATUS_CODE);
	}

	/**	设置http get - 210 返回无值/无权限	**/
	public static void setHttpGetFailStatusCode(Result result, HttpServletResponse response) {
		response.setStatus(CommonConstant.HTTP_GET_FAIL_STATUS_CODE);
		result.setCode(CommonConstant.HTTP_GET_FAIL_STATUS_CODE);
	}

	public static void setHttpPostNormalException(Result result,HttpServletResponse response) {
		response.setStatus(CommonConstant.HTTP_POST_EXCEPTION);
		result.setCode(CommonConstant.HTTP_POST_EXCEPTION);
	}

	/**	设置http post 返回成功	**/
	public static void setHttpPostSuccessStatusCode(Result result,HttpServletResponse response) {
		response.setStatus(CommonConstant.HTTP_POST_SUCCESS_STATUS_CODE);
		result.setCode(CommonConstant.HTTP_POST_SUCCESS_STATUS_CODE);
	}

	
	
}
